<%@ page import="cn.wolfcode.domain.File" %><%--
  Created by IntelliJ IDEA.
  User: 孙晓萌
  Date: 2021/8/14
  Time: 10:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<script type="text/javascript">
    function creatMail(){
        var tab=document.getElementById("tabid");
        var tr=tab.insertRow();//插入一行
        var td=tr.insertCell();//插入一列
        var td2=tr.insertCell();//插入一列
        var td3=tr.insertCell();
        var td4=tr.insertCell();
        td.innerHTML="<input type='hidden' name='filename'>";
        td2.innerHTML="<input type='file' name='filepath'>";
        td3.innerHTML="<input type='hidden' name='uid' value='${uid}'>";
        td4.innerHTML="<a href='javascript:void(0)' onclick='Delrows(this)'>删除</a>";
    }
    function Delrows(node){//当前对象是<a>里面
        var tr=node.parentNode.parentNode;//tr对象
        tr.parentNode.removeChild(tr);//tr的父对象table移除子节点f
    }
</script>
<%
    Long uid = (Long)request.getSession().getAttribute("uid");
    System.out.println(uid);
    if(uid==null||uid==0){
        response.sendRedirect("/index.jsp");
    }else {
        request.setAttribute("uid",uid);
    }
%>
<%--multiple='multiple'属性可以上传多个（选中一堆上传）--%>
<form action='/xiugaiServlet' method='post' enctype='multipart/form-data'>
    <table id="tabid">
        <tr>
            <td>
                <a href="javascript:void(0)" onclick="creatMail()">添加</a>
                <br>
            </td>
        </tr>
    </table>
    <input type='submit' value='提交'>
</form>

<%--<form action="/xiugaiServlet" method="post" enctype="multipart/form-data">
    <input type="hidden" name="filename">
    <input type="file" name="filepath">
    <input type="hidden" name="uid" value="${uid}">
    <input type="submit" value="提交">
</form>--%>
</body>
</html>
